<?php
//后台首页控制器
namespace App\Http\Controllers\Home;

use Illuminate\Http\Request;

use App\Http\Requests;

class IndexController extends CommonController
{
	//加载后台网站首页
    public function index()
    {	
	//轮播图
	
		//获取所有信息
		$lunboimg = \DB::table("lunboimg")->get();

		


		//获取信息总条数
		$lunboimgnum = \DB::table("lunboimg")->count();
		
	//新书上架
		//获取所有信息
		$newbook = \DB::table("newbook")->get();
		
	//主页选项卡
		//获取所有信息
		$xuanxiangka = \DB::table("type")->get();
		
	//主页侧边栏
		//获取所有信息
		$classone = \DB::table("classone")->get();
		
	//友情链接
		//获取所有信息
		$friendlink = \DB::table("friendlink")->get();


	//网站配置
		$config = \DB::table("config")->get();
	//热销排行榜
		//总榜
		$rank = \DB::select("select * from rank order by num desc limit 10");
		
		//童书类
		$rank1 = \DB::select("select * from rank where pid=0 order by num desc limit 10");
		//管理
		$rank2 = \DB::select("select * from rank where pid=1 order by num desc limit 10");
		//旅游
		$rank3 = \DB::select("select * from rank where pid=2 order by num desc limit 10");
		//外语
		$rank4 = \DB::select("select * from rank where pid=3 order by num desc limit 10");
	//最新动态
		$news = \DB::table("news")->get();
		
		return view("home.index",['lunboimg'=>$lunboimg,'lunboimgnum'=>$lunboimgnum,'newbook'=>$newbook,'xuanxiangka'=>$xuanxiangka,'friendlink'=>$friendlink,'classone'=>$classone,
			'rank'=>$rank,'rank1'=>$rank1,'rank2'=>$rank2,'rank3'=>$rank3,'rank4'=>$rank4,'news'=>$news,'config'=>$config
		]);


    }

    
}